extends layout

block meta
    link(rel="stylesheet", href="#{options.cdn_path}/lib/artDialog/skins/combo?/lib/artDialog/skins/default.css&v=#{options.site_version}")

block content
    // 传递参数
    optionsClass = true
    include common/_admin_navbar
    .content
        .header
            h1.page-title 网站信息设置
        ul.breadcrumb
            li
                a(href="/admin") 首页
                span.divider /
            li.active 网站信息
        .container-fluid
            .row-fluid
                .btn-toolbar
                    button.btn.btn-primary.info_btn
                        i.icon-save 
                        | &nbsp;保存
                    a.btn(href="/admin_blog/list") 返回
                    .btn-group
                .well
                    ul.nav.nav-tabs
                        li.active
                            a(href="#info", data-toggle="tab") 更新信息
                        li
                            a(href="#cache", data-toggle="tab") 缓存清理
                    #myTabContent.tab-content
                        #info.tab-pane.active
                            form#info_btn(action="/admin_options/save_update", method="post")
                                input(type="hidden", name="options.id", value="#{options.id}")
                                label 站点名
                                input.input-xlarge(type="text", name="options.site_name", value="#{options.site_name}", required="required")
                                label git链接
                                input.input-xlarge(type="text", name="options.git_url", value="#{options.git_url}", required="required")
                                label cdn
                                input.input-xlarge(type="text", name="options.cdn_path", value="#{options.cdn_path}", required="required")
                                label 腾讯微博
                                input.input-xlarge(type="text", name="options.wb_qq", value="#{options.wb_qq}", required="required")
                                label sina微博
                                input.input-xlarge(type="text", name="options.wb_sina", value="#{options.wb_sina}", required="required")
                                label 多说二级域名
                                input.input-xlarge(type="text", name="options.duoshuo_domain", value="#{options.duoshuo_domain}", required="required")
                                label 网站版本
                                input.input-xlarge(type="text", name="options.site_version", value="#{options.site_version}", required="required")
                        #cache.tab-pane

                include common/_admin_footer

block script
    script(src="#{options.cdn_path}/lib/artDialog/jquery.artDialog.js?v=#{options.site_version}")
    script
        $(function(){
            $('.info_btn').click(function(){
                $form = $('#info_btn');
                var dialog = art.dialog();
                $.post($form.attr('action')
                    , $form.serialize()
                    , function(data){
                        if(data.state){
                            dialog.content('保存成功！').time(1);
                            setTimeout(function(){
                                    location.href = '/admin_options';
                            }, 1500);
                        }else{
                            dialog.content('服务器忙，请稍候！').time(2);
                        }
                    }
                );
                return false;
            });
        });